<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 找重复，把一个数组(arr1)里重复的数放到另一个数组(arr2)里，并打印 arr2。
    [12, 32, 43, 14, 52, 12, 52, 36, 52]， 打印 [12, 52] -->
    <script>
      let arr = [12, 32, 43, 14, 52, 52, 36, 52],
        arr2 = [],
        arr3 = []

      for (let i = 0; i < arr.length; i++) {
        if (arr3.indexOf(arr[i]) === -1) {
          arr3.push(arr[i])
        } else {
          arr2.push(arr[i])
        }
      }

      console.log(arr2)
    </script>
  </body>
</html>
